package com.erp.gis.ao.idl;


import java.util.BitSet;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

import com.paipai.lang.uint32_t;
import com.paipai.lang.uint8_t;
import com.paipai.util.annotation.ApiProtocol;
import com.paipai.util.annotation.Field;
import com.paipai.util.annotation.HeadApiProtocol;
import com.paipai.util.annotation.Member;

/**
 * GIS(Region & IP等地理信息查询转换服务)Dao
 * @author hadeswang
 * @version 1.0, 2013-01-14
 */

@HeadApiProtocol(cPlusNamespace = "erp::gis::ao", needInit = true,needReset=true)
public class GisAo {
	
	@Member(cPlusNamespace=  "erp::gis::po",desc = "地区po", isNeedUFlag = true)
	public
    class RegionPo 
    {
        @Field(desc =   " 版本号   ", defaultValue=  "0  " )
        uint32_t  version;
        uint8_t  version_u;

        @Field(desc =   " 地区ID ")
        uint32_t regionId;
        uint8_t  regionId_u;
        
        @Field(desc =   " 地区名称 ")
        String regionName;
        uint8_t  regionName_u;
        
        @Field(desc =   " 父地区ID ")
        uint32_t fatherRegionId;
        uint8_t  fatherRegionId_u;
        
        @Field(desc =   " 地区属性  ",bitset=32)
        BitSet   regionProperty;
        uint8_t  regionProperty_u;
    }
	
	@Member(cPlusNamespace=  "erp::gis::po",desc = "地址信息po", isNeedUFlag = true)
	public
    class IpAddressPo 
    {
        @Field(desc =   " 版本号   ", defaultValue=  "0  " )
        uint32_t  version;
        uint8_t  version_u;

        @Field(desc =   " 国家ID ")
        uint32_t countryId;
        uint8_t  countryId_u;
        
        @Field(desc =   " 国家 ")
        String countryName;
        uint8_t  countryName_u;
        
        @Field(desc =   " 省份ID ")
        uint32_t provinceId;
        uint8_t  provinceId_u;
        
        @Field(desc =   " 省份 ")
        String provinceIdName;
        uint8_t  provinceIdName_u;
        
        @Field(desc =   " 城市ID ")
        uint32_t cityId;
        uint8_t  cityId_u;
        
        @Field(desc =   " 城市 ")
        String cityName;
        uint8_t  cityName_u;
        
        @Field(desc =   " 区或城镇ID  ")
        uint32_t   townId;
        uint8_t  townId_u;
        
        @Field(desc =   " 区或城镇  ")
        String   townName;
        uint8_t  townName_u;
        
        @Field(desc =   " ISPID ")
        uint32_t   ispId;
        uint8_t  ispId_u;
        
        @Field(desc =   " ISP ")
        String   ispName;
        uint8_t  ispName_u;
    }
	
	@ApiProtocol(cmdid = "0xC66A1801L", desc = " 根据IP获取地址信息 ")
	class GetIpAddressByIp
	{
		class Req 
		{
			@Field(desc = "机器码，必填 ")
	        String machineKey;

	        @Field(desc = "调用来源，必填 ")
	        String source;

	        @Field(desc = "场景id，必填 ")
	        uint32_t sceneId;					
			
			@Field(desc = "IP列表，必填 ")
			Set<uint32_t> ipList;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}
		class Resp 
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "地址信息 ")
			Map<uint32_t,IpAddressPo> ipAddress;
			
			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};
	
	@ApiProtocol(cmdid = "0xC66A1802L", desc = " 根据IP获取地区列表信息，由高到低 ")
	class GetSmallestRegionByIp
	{
		class Req 
		{
			@Field(desc = "机器码，必填 ")
	        String machineKey;

	        @Field(desc = "调用来源，必填 ")
	        String source;

	        @Field(desc = "场景id，必填 ")
	        uint32_t sceneId;					
			
			@Field(desc = "IP列表，必填 ")
			Set<uint32_t> ipList;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}
		class Resp 
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "地址信息 ")
			Map<uint32_t,Vector<RegionPo>> smallestRegion;
			
			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};
}
